package Enums;

public enum Repeats {
    DAILY(1,"Daily"),
    WEEKLY(7, "Weekly"),
    BIWEEKLY(14, "Bi-Weekly"),
    MONTHLY(30, "Monthly"),
    QUATERLY(91, "Quarterly"),
    SIX_MONTHS(182, "Every 6 Months"),
    YEARLY(365, "Yearly"),
    CUSTOM(0, "Custom");

    private final int days;
    private final String desc;

    private Repeats(int c, String s){
    	days = c;
        desc = s;
    }

    public int getState(){
        return days;
    }

    public String getDesc(){
        return desc;
    }
    
    public static Repeats getStateFromDesc(final String desc){
    	if(desc.equals("Daily")){
    		return DAILY;
    	} else if(desc.equals("Weekly")){
    		return WEEKLY;
    	} else if(desc.equals("Bi-Weekly")){
    		return BIWEEKLY;
    	} else if(desc.equals("Monthly")){
    		return MONTHLY;
    	} else if(desc.equals("Quarterly")){
    		return QUATERLY;
    	} else if(desc.equals("Every 6 Months")){
    		return SIX_MONTHS;
    	} else if(desc.equals("Yearly")){
    		return YEARLY;
    	} else {
    		return CUSTOM;
    	}
    }
    
    public static Repeats getStateFromInt(final int state) {
        switch (state) {
        case 1:
            return DAILY;
        case 7:
            return WEEKLY;
        case 14:
            return BIWEEKLY;
        case 30:
            return MONTHLY;
        case 91:
            return QUATERLY;
        case 182:
            return SIX_MONTHS;
        case 365:
            return YEARLY;
        default:
            return CUSTOM;
        }
    }

}
